package file;

import java.io.File;

public class FileDEmo {
    public static void main(String[] args) {
        File file = new File("./demo.txt");
        if (file.exists()) {
            long length = file.length();
            System.out.println("文件字节数：" + length);
            boolean canRead = file.canRead();
            System.out.println("文件是否可读：" + canRead);
            boolean canWrite = file.canWrite();
            System.out.println("文件是否可写：" + canWrite);
            boolean isHidden = file.isHidden();
            System.out.println("文件是否隐藏：" + isHidden);
        } else {
            System.out.println("文件不存在");
        }
    }
}
